// 项目中所有的接口请求都在这里
import instance from "./request";

// 定义接口请求
// 首页
export function getIndexData(params) {
    return instance({
        url: '/index/index',
        method: 'get',
        params: params,
    })
}


// 专题页请求
export function getTopicData(params) {
    return instance({
        url: '/topic/list',
        method: 'get',
        params: params,
    })
}




// 分类页请求
export function getCategoryData(params) {
    return instance({
        url: '/catalog/index',
        method: 'get',
        params: params,
    })
}
//当前分类页请求
export function getCurrentCategory(params) {
    return instance({
        url: '/catalog/current',
        method: 'get',
        params: params,
    })
}





// 购物车请求
export function getCarData(params) {
    return instance({
        url: '/cart/index',
        method: 'get',
        params: params,
        headers: { 'X-Nideshop-Token': sessionStorage.getItem('token') }
    })
}
// 删除请求
export function PostShanChu(params) {
    return instance({
        url: '/cart/delete',
        method: 'post',
        data: params,
        headers: { 'Content-Type': 'application/json' },
        headers: { 'X-Nideshop-Token': sessionStorage.getItem('token') }
    })
}




// 我的页登录请求
export function loginFn(params) {
    return instance({
        url: '/auth/loginByWeb',
        method: 'post',
        data: params,
        headers: { 'Content-Type': 'application/json' }
    })
}


// 根据关键字	实时搜索功能接口
export function searchgoods(params) {
    return instance({
        url: '/goods/list',
        method: 'get',
        params: params,
    })
}

//商品详情页  接口
export function getDetail(params) {
    return instance({
        url: '/goods/detail',
        method: 'get',
        params: params,
    })
}

// 加入购物车
export function addCarData(params) {
    return instance({
        url: '/cart/add',
        method: 'post',
        data: params,
        headers: { 'content-type': 'application/json' },
        headers: { 'X-Nideshop-Token': sessionStorage.getItem('token') }
    })
}

// 获取购物车总数量
export function getGoodscount(params) {
    return instance({
        url: '/cart/goodscount',
        method: 'get',
        params: params,
        headers: { 'X-Nideshop-Token': sessionStorage.getItem('token') }
    })
}

































